
package com.zsrt.day20170405;

/**
 * 
 * while 需要明确三个条件
 * 1.从哪里开始
 * 2.到哪里结束
 * 3.步长
 * 
 * @author jmj
 *
 */
public class WhileDemo01 {
	public static void main(String[] args) {
		int begin =1;
		int end =9;
		
		int sum =0;
		while(begin<=end){
			sum =sum + begin;
			// 步长  
			begin = begin +2;
		}
		System.out.println(sum);
	}

}
